package com.baichang.taoshunda.dao.impl;

import com.baichang.taoshunda.dao.GoodsSpecDao;
import com.baichang.taoshunda.entity.GoodsSpec;
import com.baichang.framework.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class GoodsSpecDaoImpl extends BaseDaoImpl<GoodsSpec> implements GoodsSpecDao {

    @Override
    public List<Map<String, Object>> findGoodsSpec(Integer goodsId) {
        String sql = " SELECT * FROM {table} WHERE goods_id=? ";
        return queryForMapList(sql, goodsId);
    }

    @Override
    public boolean deleteByGoodsId(Integer isPrice, Integer goodsId) {
        String sql="DELETE FROM t_goods_spec  WHERE goods_id=? AND is_price=? ";
        return update(sql,goodsId,isPrice)>0;
    }
}